class DIGRAPH_NODE_SET_VIEW{NTP,GTP<$RO_DIGRAPH{NTP}} < $RO_SET{NTP}
****
A view of the nodes of a digraph as a set. This is useful for looking at set properties of the nodes in the graph, for instance, finding the union or intersection of the nodes in two graphs Please see the notes in the module file


Ancestors
$RO_SET{_} $STR $CONTAINER{_} $ELT{_}
$ELT RO_SET_INCL{_} COMPARE{_}

Descendants
DIGRAPH_NODE_SET_VIEW{_}



Public


Features
as_array: ARRAY{E} .. Included as as_array
copy: SAME
**** Return a copy of the nodes in this set
create(g: GTP): SAME
**** Create a new view of the nodes of "g"
diff(s: $RO_SET{E}): SET{E} .. Included as diff
**** See the comment for "union" and $RO_SET::diff
diff_view(s: $RO_SET{E}): $RO_SET{E} .. Included as diff_view
**** See the comment for "union_view"
equals(a:$RO_SET{E}): BOOL .. Included as equals
**** Returns 'true' if every element of self is elt_eq to an element in 'a' and vice versa. Neither may be void.
has(n: NTP): BOOL
**** Return true if the original graph has the node "n"
intersection(s:$RO_SET{E}): SET{E} .. Included as intersection
**** See the comment for "union" and $RO_SET::intersection
intersection_view(s: $RO_SET{E}): $RO_SET{E} .. Included as intersection_view
**** See the note for "union_view"
is_empty: BOOL .. Included as is_empty
**** Do not do size=0. Finding size may require iteration through all elements - quite wasteful for just "is_empty"
is_subset_of(s: $RO_SET{E}): BOOL .. Included as is_subset_of
**** Return true if "self" is a subset of "s"
size: INT
**** Return the number of nodes in the orignal graph
str: STR .. Included as str
**** Prints out a string version of the array of the components that are under $STR
sym_diff(s: $RO_SET{E}): SET{E} .. Included as sym_diff
**** See the comment for "union" and $RO_SET::sym_diff
sym_diff_view(s: $RO_SET{E}): $RO_SET{E} .. Included as sym_diff_view
**** See the comment for "union_view"
union(s: $RO_SET{E}): SET{E} .. Included as union
**** Union is defined by default to create a "view" and then convert that into a SET. Subtypes may redefine this behavior to return a set of type "SAME", without going through a view
union_view(s: $RO_SET{E}): $RO_SET{E} .. Included as union_view
**** Return a read-only "view" of the union of "self" and "s" The resulting view just points to the two component sets and computes its elements on-the-fly, as needed. As a result, this form of union requires almost no additional space but may it may take slightly longer to perform operations

Iters
elt!: NTP
**** Return the nodes of the original graph


Private

create_from_internal(s: $RO_SET{E}): SET{E} .. Included as create_from_internal
**** Used as an auxilliary routine by the view creation routines. When the return type can be any $RO_SET, then by default a "SET" will be constructed and used
elt_eq(e1,e2:ETP):BOOL .. Included as elt_eq
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_hash(e:ETP):INT .. Included as elt_hash
**** A hash value associated with an element. Must have the property that if "elt_eq(e1,e2)" then "elt_hash(e1)=elt_hash(e2)". Can be defined to always return 0, but many routines will then become quadratic. Uses object "id" by default. May be redefined in descendants.
elt_lt(e1,e2:ETP):BOOL .. Included as elt_lt
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_nil: ETP .. Included as elt_nil
**** Return the nil value. If the element is under $NIL then return e.nil. Otherwise, return void
_
get_set_of_self: SAME .. Included as get_set_of_self
attr graph: GTP;
attr graph: GTP;
is_elt_nil(e:ETP):BOOL .. Included as is_elt_nil

The Sather Home Page